package com.wjerp.tplus.server.common.utils;

import org.springframework.context.ApplicationContext;

/**
 * 上下文获取工具类
 *
 * @author mac
 */
public class SpringContextUtil {
  private static ApplicationContext applicationContext;

  public static void setApplicationContext(ApplicationContext context) {
    applicationContext = context;
  }

  public static Object getBean(String beanId) {
    return applicationContext.getBean(beanId);
  }

  public static <T> T  getBeanByClass(Class<T> cls){
    return applicationContext.getBean(cls);
  }
}